package com.richard.base.starter

import android.os.Trace
import com.alibaba.android.arouter.launcher.ARouter
import com.richard.base.BaseApplication
import com.richard.base.BuildConfig
import com.richard.base.constants.GlobalConstants
import com.richard.base.route.RouterDelegate
import com.wxy.appstartfaster.task.AppStartTask

/**
 ***************************************
 * 项目名称:Giggle
 * @Author wuzhiguo
 * 邮箱：wuzhiguo@ksjgs.com
 * 创建时间: 2020/6/1     5:55 PM
 * 用途:
 ***************************************

 */
class InitArouterTask : AppStartTask() {
    override fun run() {
        if (BuildConfig.DEBUG) { //日志开启
            ARouter.openLog()
            //调试模式开启，如果在install run模式下运行，则必须开启调试模式
            ARouter.openDebug()
        }
        ARouter.init(BaseApplication.instance)
        RouterDelegate.init(object :RouterDelegate.RouterConfig{
            override fun getCurrentActivityStatisticKey(): String? {
                return GlobalConstants.KEY_FROM_ACTIVITY
            }

            override fun getCurrentActivityStatisticName(): String? {
                return BaseApplication.currentActivityStatisticPageName
            }
        })
    }

    override fun isRunOnMainThread(): Boolean {
        return false
    }

    override fun needWait(): Boolean {
        return true
    }


}